<template>
	<view>
		<ImageUploader api-url="/api/customer/home/upload" @upload-success="handleSuccess" @upload-error="handleError"
			@upload-progress="handleProgress"></ImageUploader>
	</view>
</template>

<script setup>
	import {
		ref
	} from "vue";
	import ImageUploader from "@/components/ImageUpload/index.vue";
	const uploadData = ref();

	const handleSuccess = async (result) => {
		uploadData.value = await result.data;

		console.log("上传成功:", result);
		uni.showToast({
			title: "上传成功",
			icon: "success"
		});
	};

	const handleError = (error) => {
		console.error("上传错误:", error);
	};

	const handleProgress = (progress) => {
		console.log("上传进度:", progress);
	};
</script>